UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gja0Qe2YWnEp6yULKMYMhYa4wCtF/6X90iCgwQKOCx0='
WHERE
key_id = 'd17c7dd49bb242dedb46b615c698d4e09965e1954048b2f3f2630d033750b344'
AND (
token = 'Gja0Qe2YWnEp6yULKMYMhYa4wCtF/6X90iCgwQKOCx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)