UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oQvt2e7yHSGtw908OGJJmxshWFU7toSO3hEtCe1d618=' 
WHERE 
  key_id = 'b8b1b6bdc110a50421061a9471edfae8f4fead77ea614e65602663c4344b09ee' 
  AND (
    token = 'oQvt2e7yHSGtw908OGJJmxshWFU7toSO3hEtCe1d618=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043