UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AMi1Dv2EIAiNzMjuLCMrc199Iri1j0VJ0L+ZAcR09nI='
WHERE
key_id = '8f858ea58c7bad0af0857ab146ffd972b9bc731c2f4b411f5e12d6954153d2f0'
AND (
token = 'AMi1Dv2EIAiNzMjuLCMrc199Iri1j0VJ0L+ZAcR09nI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)