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

Query time 0.00020