UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mavd4GYNwvC12s2qIKSD4KX8kOxWI5jFxLBMJE0ELLU='
WHERE
key_id = '25405ac59d8ded1703125b1bdb216c6d1a3d1ffd60585d9e77e3e0aba7cc8ae2'
AND (
token = 'mavd4GYNwvC12s2qIKSD4KX8kOxWI5jFxLBMJE0ELLU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)