UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z21q1F/4BzuSpdr2j1wB38N6BP1VYu6EmZPp81SBWYk='
WHERE
key_id = 'c21b12ebf743d30c3cd1d873cfd5bdee91934309e13a5724717f5fce09561fc7'
AND (
token = 'z21q1F/4BzuSpdr2j1wB38N6BP1VYu6EmZPp81SBWYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)