UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd3GzSuUVYV/QWBjjpuyPtMlwAcLQLD58j0MWJE5IdjE='
WHERE
key_id = 'b42f1b578fe432ec9e6abe63adc709a8dede95766d276026196b6a6f6e7f01a4'
AND (
token = 'd3GzSuUVYV/QWBjjpuyPtMlwAcLQLD58j0MWJE5IdjE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)