UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lZglv73+pa9mL1vE5prXskCByiWaiB+gmXuEYl4M5dc=' 
WHERE 
  key_id = '1ca93b2e4ff11ae9acae6b14e6cfa8461a7761500e34877f202e0af42380e4cf' 
  AND (
    token = 'lZglv73+pa9mL1vE5prXskCByiWaiB+gmXuEYl4M5dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025