UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DyD2uxRZeBceC7QVWNcLzubV3fbZk+okduL8EAE7BAY='
WHERE
key_id = 'd671260c85e94c1501a7e3bef6434a62b990ec8d3a8a518943f106a826a57fa1'
AND (
token = 'DyD2uxRZeBceC7QVWNcLzubV3fbZk+okduL8EAE7BAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)