UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j9E7NE+lZv71q06Z6ScgmRhfF3wOsMHgUoZy4ggin8o='
WHERE
key_id = '8211967f166e75a1be6c82eae583f3f925fca7392df99fa60f3532c971d9c46a'
AND (
token = 'j9E7NE+lZv71q06Z6ScgmRhfF3wOsMHgUoZy4ggin8o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)