UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WqaGB2/CxqOy0jO1nCAzpkbqs3VUAxiOCiOHco9vbzw=' 
WHERE 
  key_id = '5e654c83919b7e6d2d896f161b65a297cdb71c2e62a10e4c4619fc4cc1f10c09' 
  AND (
    token = 'WqaGB2/CxqOy0jO1nCAzpkbqs3VUAxiOCiOHco9vbzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058