UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ubTs3d1U/3t/rnXJN+ATW5RKaLoS1GLXtcL9iZVpVe0='
WHERE
key_id = '8a508895a983ed2ec7b11bafb2424ba2941b3d065490724b0840e89678f4ac94'
AND (
token = 'ubTs3d1U/3t/rnXJN+ATW5RKaLoS1GLXtcL9iZVpVe0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)