UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Vf34Qke9GbfxebiZMyoJA4+FHp9OLxTojRpwVFBygI8='
WHERE
key_id = '99f64a963181cc64f0a1f6bdb291a584eac8561750416f2fdb5b2e64cfb8cf4a'
AND (
token = 'Vf34Qke9GbfxebiZMyoJA4+FHp9OLxTojRpwVFBygI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)