UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'knHqmuNHf0U2cJdr+QyT9NogpylOWswMSRtxjjK0Bpk='
WHERE
key_id = '162c256f6f11371726367c8121a8b92fcfd04f3a5f7ad6203844a5b3b856c7a5'
AND (
token = 'knHqmuNHf0U2cJdr+QyT9NogpylOWswMSRtxjjK0Bpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)