UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cC7bp1hEkpBzJgL4aJLY+ocXUqI8wo2xsIXrFYWjGJY='
WHERE
key_id = 'ca0cb54b0513a49bbd3b190492e649a3ea1c976a0b30de9aa620c6768dafeae5'
AND (
token = 'cC7bp1hEkpBzJgL4aJLY+ocXUqI8wo2xsIXrFYWjGJY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)