UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oB8Dm6UOozPqx1S/2Hpdo8mQWEcdNAWvGtfk4+wLyac='
WHERE
key_id = 'a9b0196600172b8e96659731b66e181ce85c52378db0c68d21ebf32a56018002'
AND (
token = 'oB8Dm6UOozPqx1S/2Hpdo8mQWEcdNAWvGtfk4+wLyac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)