UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lMaITN3ctGS/4Oyr7sOxlZYMl3lI27Dp8K6BflDU+30='
WHERE
key_id = 'd3fff4c212708332fbc8b4317e252d8c6a62866a947a69f4d88055a8994b18f4'
AND (
token = 'lMaITN3ctGS/4Oyr7sOxlZYMl3lI27Dp8K6BflDU+30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)