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