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