UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kpZ1xZYQyw2CczaCP0cNLjiHJoNlJca1KbDy1FnbGX8=' 
WHERE 
  key_id = 'd049e4486b340066bfa5ccb4705fc1071c27b623a3611f44377175bbb524774e' 
  AND (
    token = 'kpZ1xZYQyw2CczaCP0cNLjiHJoNlJca1KbDy1FnbGX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034