UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hl18J966CMxlS5vDc6KdR2H32RtcsKNkhPpqMSGbBvs=' 
WHERE 
  key_id = '86cba395486d0b5034bb8a49e6988bce0e3744fac8339aec9347d60fef838655' 
  AND (
    token = 'Hl18J966CMxlS5vDc6KdR2H32RtcsKNkhPpqMSGbBvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034