UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JaWlv+HigNk5YiUsxd1I3fe/fhE6DkPZAk0+p9d70VY=' 
WHERE 
  key_id = '7e184afe379e952763bc5a375466b5672e8417ed7aed579b93a63c2dd07ae763' 
  AND (
    token = 'JaWlv+HigNk5YiUsxd1I3fe/fhE6DkPZAk0+p9d70VY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038