UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ryq8CAKBYLtvc3W6GAa+QD6gKu+GDp45vTMvc9D1iQs='
WHERE
key_id = '8fb498dd0829adcaa7551ccf2cd059359be7f730c6e4c329e50b3ae1a04cf387'
AND (
token = 'ryq8CAKBYLtvc3W6GAa+QD6gKu+GDp45vTMvc9D1iQs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)