UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JtoyIyLfLEe89QiCsJ1gRQ9K4pYDF2vDGj8u1y0l0DI='
WHERE
key_id = 'bf1bdb15cc29d0bf7ceeddd57bd84fd6019d3a334f603ec6d8766fb438d92501'
AND (
token = 'JtoyIyLfLEe89QiCsJ1gRQ9K4pYDF2vDGj8u1y0l0DI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)