UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHzj+lGcw5JmRLkD4Dm2Hq27Hup7eiLWd0XQG7s3pHE=' 
WHERE 
  key_id = 'ed3a4ce8074bca4b21f1b168436d95b93e2df4ecca81be796584576b22a09d51' 
  AND (
    token = 'BHzj+lGcw5JmRLkD4Dm2Hq27Hup7eiLWd0XQG7s3pHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036