UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '65wkPJf33Iy6jDmNjFLGXmwaVjcFUHQYJP3ma9vp7zA=' 
WHERE 
  key_id = '413021afe580a94fd89e961f52f7bd99cca90fc94c0d54425fd94487ef5ce2d2' 
  AND (
    token = '65wkPJf33Iy6jDmNjFLGXmwaVjcFUHQYJP3ma9vp7zA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045