UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ndbkV8sTEmGQ7ddjPNxokZ3H7BW6ZeBgCob3wAteH9o='
WHERE
key_id = 'bd7635e65d3064601d5b0caf2752e1fa8358925958236c4de7d415042bdf0a1c'
AND (
token = 'ndbkV8sTEmGQ7ddjPNxokZ3H7BW6ZeBgCob3wAteH9o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)