UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qef0q864R+t+AO8ubVws/HqAmcHr+3hZHxd/mAi3Hmc='
WHERE
key_id = '0897b731214378da75bc42ffd0463ec3f778f41572f857fbb7e775c2de6133ef'
AND (
token = 'Qef0q864R+t+AO8ubVws/HqAmcHr+3hZHxd/mAi3Hmc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)