UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gau+cHyX3ISACMIi2b2qhy8gnCaY6Xntog2B06Dkt3U='
WHERE
key_id = 'e638ff47ae082f35c1ca2f23d6d6fd41b492092ac4860c275c51d3cad4c765eb'
AND (
token = 'Gau+cHyX3ISACMIi2b2qhy8gnCaY6Xntog2B06Dkt3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)