UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZdkmLBEVf121TG8T5zOKmajHHZ2+GBbIbhx9dMoyyRs='
WHERE
key_id = '38c62cfefca43fe47b8d052dc250b2f8acafb63b2a08e4ac8c880df73946474b'
AND (
token = 'ZdkmLBEVf121TG8T5zOKmajHHZ2+GBbIbhx9dMoyyRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)