UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QK0HkJOkfsClXkUM10UlgI+FesLe7xpVaxKVrWhYLhs=' 
WHERE 
  key_id = '471b092b5798cdb8564c68e407bd54c2a047dbdcb6904160a663f463827f5eb2' 
  AND (
    token = 'QK0HkJOkfsClXkUM10UlgI+FesLe7xpVaxKVrWhYLhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036