UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L6B2YQQl7eIrInNU7lEone/6pGwKIkgK3IVI5EB1m2w='
WHERE
key_id = 'a395673688720db2b8bbe7aa8fdb44b96590595ee07a955178f7c994c9f30e42'
AND (
token = 'L6B2YQQl7eIrInNU7lEone/6pGwKIkgK3IVI5EB1m2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)