UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ARto6iRp587zbGg9BnQNC+aBvs9aYOFbdJ7CijgpMB8=' 
WHERE 
  key_id = 'c8112ffefcce96f544068db3786a03eb775f00c27e0d2108c99dd22530d97d71' 
  AND (
    token = 'ARto6iRp587zbGg9BnQNC+aBvs9aYOFbdJ7CijgpMB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058