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