UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UKJ1zT7+CIkmNEA4i7Z0pVPCYWYR2o6GlAz8noROPw8='
WHERE
key_id = '6867c1fcd0bc933e243cc8eb78aac168063c871f7985e4651a2c43de72b0e483'
AND (
token = 'UKJ1zT7+CIkmNEA4i7Z0pVPCYWYR2o6GlAz8noROPw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)