UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r3FvZQ569NpEcArPOokTQjUY48baik/XVQvCUCeNBf0=' 
WHERE 
  key_id = '5516214a55bdf303ea7ec7006b0aad3fc74c8674afd400a067e6fd477667a8f4' 
  AND (
    token = 'r3FvZQ569NpEcArPOokTQjUY48baik/XVQvCUCeNBf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029