UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sM1jmPIhhkkSiDvg8jcsFGaC79Zpz+IaYZzznvlySqA='
WHERE
key_id = 'e1ba6f1f07bcbf15a06753b4c73df255f2cb49a069516b05ae9269f109cc07c2'
AND (
token = 'sM1jmPIhhkkSiDvg8jcsFGaC79Zpz+IaYZzznvlySqA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)