UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jNI2xKaqVmytQN86kx9uVA5JE2eC3DwDm7zem2OlNOQ='
WHERE
key_id = 'd47e0e0a15aa91c1ba245cf4ba1bf8be57150f6caec60ee5443e60275b678914'
AND (
token = 'jNI2xKaqVmytQN86kx9uVA5JE2eC3DwDm7zem2OlNOQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)