UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zv0oKyzEavRzCbx9aJEivAIHEeP3xM6nR0qCEMtcFzg=' 
WHERE 
  key_id = '8450a22af4199da0b362e679f713f0c363be2432d85231b69c22b840297af8cf' 
  AND (
    token = 'zv0oKyzEavRzCbx9aJEivAIHEeP3xM6nR0qCEMtcFzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032