UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Ree+K2fPMGXf4881U/naLmgYxMkzbvRzMgTol8vdbw='
WHERE
key_id = 'cf5df379667a91d94b2400ef46d42934406d2abbbdee2fb73576908ae91d06df'
AND (
token = '9Ree+K2fPMGXf4881U/naLmgYxMkzbvRzMgTol8vdbw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)