UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5028zROBXXNiY8d2TBlecLb4/41XHzYYJQJq7XPZXnU=' 
WHERE 
  key_id = '552b47cf94a5f38e73bb64e6840a8a85cd982be57779acf584276877d209f78a' 
  AND (
    token = '5028zROBXXNiY8d2TBlecLb4/41XHzYYJQJq7XPZXnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032