UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 're7f+4Op2Af2nQxJ0nPeo0SYcieEmys7r34r0uYjq6Y=' 
WHERE 
  key_id = '587e8e3ad3cbeec294fb46d2e1456f2c30d00db83d93f4c0ddaa5e704c8ffdc1' 
  AND (
    token = 're7f+4Op2Af2nQxJ0nPeo0SYcieEmys7r34r0uYjq6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030