UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T8PcNYRKUjoOhhwBB/T5XKlexRijSgGp7QvDX8lLkT8='
WHERE
key_id = 'ca5b3a1497df1e56b752794c7688f3a413910454aa5f98922d98012891979409'
AND (
token = 'T8PcNYRKUjoOhhwBB/T5XKlexRijSgGp7QvDX8lLkT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)