UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TrKG1BWKGE2YWh6bIQV70Ch4n49qN+Wx06RQzNklRxw='
WHERE
key_id = 'aae4a694e46e068bcf755b9d1047cd112f2dd3c8edf593780aa05639e8aa6430'
AND (
token = 'TrKG1BWKGE2YWh6bIQV70Ch4n49qN+Wx06RQzNklRxw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)